package io.wmy.supex.modules.demo.controller;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

//@CrossOrigin //只标注注解，没有任何参数，当前控制器所有方法都支持跨域请求
//@CrossOrigin(maxAge = 3600)
//@CrossOrigin(origins = "http://domain2.com", maxAge = 3600)
@CrossOrigin(origins = "http://domain2.com", allowedHeaders = "")
@RequestMapping("/demo/cors")
public class CorsController {

    @CrossOrigin
    @RequestMapping("/{id}")
    public String get(@PathVariable Long id) {
       return null;
    }

    @CrossOrigin("http://domain2.com")
    @RequestMapping("/{id}")
    public String save(@PathVariable Long id) {
        return null;
    }

    @CrossOrigin("http://domain2.com")
    @RequestMapping("/{id}")
    public String update(@PathVariable Long id) {
        return null;
    }

    @CrossOrigin("http://domain2.com")
    @RequestMapping("/{id}")
    public String delete(@PathVariable Long id) {
        return null;
    }
}
